package Collection;

import java.util.ArrayList;
import java.util.Collections;
import java.util.List;

public class testCollection {
    public static void main(String[] args) {
        List<String>list =new ArrayList<>();;
//        list.add("你快乐了嘛");
//        list.add("针对我好嘛");
//        String a ="你快乐了嘛";
//        String b ="你在想什么";
        list.add("b");
        list.add("a");
        list.add("c");
        list.add("d");
        list.add("e");
        Collections.sort(list);
        String a ="a";
        int i = Collections.binarySearch(list, a);
        System.out.println(i);
        if(Collections.binarySearch(list, a) != -1){
            System.out.println("匹配到了！");
        }
        boolean contains = list.contains(a);
        System.out.println(contains);
    }
}
